package com.young.springdemo.service.factory;


/**
 * @author Young
 * @description 水果工厂
 * @date 20:50 2020/4/12
 **/
public class FruitFactory {
    public static Fruit getFruit(String type){
        Fruit fruit = null;
        if (type.equalsIgnoreCase("apple")){
            fruit = new Apple();
        }
        else if (type.equalsIgnoreCase("pear")){
            fruit = new Pear();
        }
        return fruit;
    }
}
